package com.taoym.voucher.xcx.controller;

import com.taoym.voucher.common.response.Response;
import com.taoym.voucher.xcx.service.XcxImageInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;
import java.util.List;

@RestController
@RequestMapping("/image")
@Api(tags = "图片信息控制器")
@Validated
public class XcxImageInfoController {

    @Autowired
    private XcxImageInfoService xcxImageInfoService;

    @GetMapping("/my-poster")
    @ApiOperation("生成我的海报")
    public Response<String> getMyPoster() {
        return Response.success(xcxImageInfoService.getMyPoster());
    }

    @GetMapping("/get")
    @ApiOperation("查询图片")
    public Response<List<String>> listImages(@RequestParam @NotNull(message = "图片类型不能为空") Integer type) {
        return Response.success(xcxImageInfoService.listImages(type));
    }
}
